import {create} from 'zustand/react';
import {createSelectors} from '@/utils/zustandUtil.ts';

interface BearState {
    bears: number;
    increase: (by: number) => void;
    increment: () => void;
    removeAllBears: () => void;
}

const useBearStore = create<BearState>()(set => ({
    bears: 0,
    increase: by => set(state => ({bears: state.bears + by})),
    increment: () => set(state => ({bears: state.bears + 1})),
    removeAllBears: () => set({bears: 0}),
}));

export const useBearStoreSelector = createSelectors(useBearStore);
